//
//  ZMSeventhVC.m
//  demo
//
//  Created by chenzm on 2018/8/17.
//  Copyright © 2018年 chenzm. All rights reserved.
//

#import "ZMSeventhVC.h"

#import "ZMCoding.h"

@interface ZMSeventhVC ()

@end

@implementation ZMSeventhVC

- (void)initView {
    [super initView];
    ZMCoding *coding = [ZMCoding new];
    coding.coderID = @"99";
    coding.nickName = @"rattanchen";
    coding.phoneNumber = @"138****8888";
    
    NSString *path = [ZMTools getDomainsPathWithFile:@"123"];
    BOOL isSuc = [NSKeyedArchiver archiveRootObject:coding toFile:path];
    if (isSuc == YES) {
        self.testLabelText = @"归档成功, 点击按钮取出模型中对应的值";
    }else{
        self.testLabelText = @"归档失败";
    }
}

- (void)buttonClick:(UIButton *)sender {
    NSString *path = [ZMTools getDomainsPathWithFile:@"123"];
    ZMCoding *coding = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
    coding.coderID = @"999";
    if (sender.tag == 0) {
        self.testLabelText = coding.coderID;
    } else if (sender.tag == 1) {
        self.testLabelText = coding.nickName;
    } else {
        self.testLabelText = coding.phoneNumber;
    }
}


- (NSArray *)buttonTitleArray {
    return @[@"ID", @"昵称", @"手机号"];
}

@end
